/**
 * Created by zhangwx on 2015/10/20.
 */

function selectCityList(data){
    this.cityList=data;
    this.defaultAnchor = BMAP_ANCHOR_TOP_LEFT;
    this.defaultOffset = new BMap.Size(5,5);

}
selectCityList.prototype = new BMap.Control();
selectCityList.prototype.initialize=function(map){

    var Panel=document.createElement("div");
    Panel.className="";
    var selectDiv="<div><span></span><i></i></div>";

    var cityPanel="<div><span>城市列表</span><div><span>当前城市:</span></div><div id=cityList ></div></div>";

    var html="<ul>";
    for(var i in this.cityList){
        html+="<li class=ProList>"+this.cityList[i].name+"</li>";
        for(var j in this.cityList[i].cityList){
            if(j==7){
                html+="<li class=ProList></li>";
                html+="<li class=CityList>"+this.cityList[i].cityList[j].name+"</li>";
            }else{
                html+="<li class=CityList>"+this.cityList[i].cityList[j].name+"</li>";
            }

        }
    }
    html+="</ul>";
    $(html).appendTo($("#cityList"));
    $(selectDiv).appendTo(Panel);
    $(cityPanel).appendTo(Panel);
    map.getContainer().appendChild(Panel);
    return Panel;

}